home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / mrcry204.zip / CARDS.EKA < prev    next >
Text File  |  1991-03-04  |  681b  |  18 lines

  1. ; This example demonstrates how to use Mercury's built-in
  2. ; FACT function (FACT(x) = x factorial).  The problem is:
  3. ; In a bridge game, the declarer controls 7 trump cards.
  4. ; We must determine the probability that the remaining
  5. ; 6 trump cards are evenly distributed (3 and 3) among
  6. ; the opposing two players.  We calculate both the
  7. ; approximate and the exact probability in this example.
  8.  
  9. ; the binomial coefficient formula
  10. ; ways of choosing k of n items
  11. C(n,k) := BINOM(n,k)     ; = FACT(n) / (FACT(k) FACT(n-k))
  12.  
  13. ; approximate probability of 3-3 split
  14.   ProbApprox = C(6,3) / 2^6
  15.  
  16. ; exact probability of 3-3 split
  17.   ProbExact = C(6,3) * C(20,10) / C(26,13)
  18.